<cc:page type="normal" style="standard" showSidebar="false" showHeader="false" />
<cc>

   CCService cs = new CCService(userInfo);

   int start= Integer.parseInt(request.getParameter("djy")==null?"":request.getParameter("djy")+"");//页码
   int limit= Integer.parseInt(request.getParameter("mysl")==null?"":request.getParameter("mysl")+"");//每页条数

   StringBuilder strBuilder = new StringBuilder();
   strBuilder.append("ownerid ='"+ userInfo.getUserId() +"' and is_deleted='0' ");
   if (request.getParameter("khzm") != null) {
     String khzm = request.getParameter("khzm") + "";
     strBuilder.append(" and khzm like '%"+ khzm +"%' ");
   }
   if (request.getParameter("khdj") != null) {

     String str = request.getParameter("khdj") + "";
     String[] arr = str.split(",");
     if (arr.length == 1 && arr[0].equals("公海")) 
     {
        strBuilder.append(" and khdj is null ");
     } else {
        strBuilder.append(" and ( khdj in (");
        Boolean flag = false;
        String level = "";
        for (int i = 0; i < arr.length; i++) {
          if (arr[i].equals("公海")) {
              flag = true;
          } else {
              level += "'"+ arr[i] +"',";
          }
        }
        if (level.length() > 0) {
            level = level.substring(0, level.length() - 1);
        }
        strBuilder.append(level);
        strBuilder.append(") ");
        if (flag) {
            strBuilder.append(" or khdj is null ) ");
        }
     }

     // strBuilder.append(" and (khdj is null or khdj in ('D','A')) ");
   }
   if (request.getParameter("sszsxmccname") != null) {
     String str = request.getParameter("sszsxmccname") + "";
     String[] arr = str.split(",");
     strBuilder.append(" and sszsxm in ( ");
     for (int i = 0; i < arr.length; i++) {
       if (i == arr.length - 1) {
         strBuilder.append("'"+ arr[i] +"' ");
       } else {
         strBuilder.append("'"+ arr[i] +"',");
       }
     }
     strBuilder.append(") ");
   }
   if (request.getParameter("sszdfzccname") != null) {
     String str = request.getParameter("sszdfzccname") + "";
     String[] arr = str.split(",");
     strBuilder.append(" and sszdfz in ( ");
     for (int i = 0; i < arr.length; i++) {
       if (i == arr.length - 1) {
         strBuilder.append("'"+ arr[i] +"' ");
       } else {
         strBuilder.append("'"+ arr[i] +"',");
       }
     }
     strBuilder.append(") ");
   }
   if (request.getParameter("zsfqccname") != null) {
     String str = request.getParameter("zsfqccname") + "";
     String[] arr = str.split(",");
     strBuilder.append(" and zsfq in ( ");
     for (int i = 0; i < arr.length; i++) {
       if (i == arr.length - 1) {
         strBuilder.append("'"+ arr[i] +"' ");
       } else {
         strBuilder.append("'"+ arr[i] +"',");
       }
     }
     strBuilder.append(") ");
   }
   if (request.getParameter("createdate") != null) {
     String str = request.getParameter("createdate") + "";
     String[] arr = str.split(",");
     strBuilder.append(" and createdate between ");
     strBuilder.append("'"+ arr[0] +"' and '" + arr[1] + "' ");
   }
   if (request.getParameter("zhycgjrq") != null) {
     String str = request.getParameter("zhycgjrq") + "";
     String[] arr = str.split(",");
     strBuilder.append(" and zhycgjrq between ");
     strBuilder.append("'"+ arr[0] +"' and '" + arr[1] + "' ");
   }
   if (request.getParameter("zhxgsj") != null) {
     String str = request.getParameter("zhxgsj") + "";
     String[] arr = str.split(",");
     strBuilder.append(" and zhxgsj between ");
     strBuilder.append("'"+ arr[0] +"' and '" + arr[1] + "' ");
   }
   if (request.getParameter("zhlfrq") != null) {
     String str = request.getParameter("zhlfrq") + "";
     String[] arr = str.split(",");
     strBuilder.append(" and zhlfrq between ");
     strBuilder.append("'"+ arr[0] +"' and '" + arr[1] + "' ");
   }
   if (request.getParameter("wgjts") != null) {
     String str = request.getParameter("wgjts") + "";
     strBuilder.append(" and wgjts = '" + str + "' ");
   }
   if (request.getParameter("wlfts") != null) {
     String str = request.getParameter("wlfts") + "";
     strBuilder.append(" and wlfts = '" + str + "' ");
   }
   if (request.getParameter("lyfl") != null) {
     String str = request.getParameter("lyfl") + "";
     strBuilder.append(" and lyfl = '" + str + "' ");
   }
   if (request.getParameter("ejfl") != null) {
     String str = request.getParameter("ejfl") + "";
     strBuilder.append(" and ejfl = '" + str + "' ");
   }
   if (request.getParameter("khlyqd") != null) {
     String str = request.getParameter("khlyqd") + "";
     String[] arr = str.split(",");
     strBuilder.append(" and khlyqd in ( ");
     for (int i = 0; i < arr.length; i++) {
       if (i == arr.length - 1) {
         strBuilder.append("'"+ arr[i] +"' ");
       } else {
         strBuilder.append("'"+ arr[i] +"',");
       }
     }
     strBuilder.append(") ");
   }
  
   List<CCObject> ncxmList1 = cs.cquery("zskhxx", strBuilder.toString());
   List<CCObject> ncxmList = cs.cquery("zskhxx", strBuilder.toString() + " order by zhycgjrq desc limit "+(start-1)*limit+","+limit+"");
   net.sf.json.JSONObject obj = new net.sf.json.JSONObject();
   obj.put("totalCount", ncxmList1.size());
   net.sf.json.JSONArray js = net.sf.json.JSONArray.fromObject(ncxmList);
   obj.element("data", js);
   obj.element("sql", strBuilder.toString());
   request.setAttribute("jsonmsg", obj.toString());
</cc>
<cc:forward page="/platform/activity/task/getNodes.jsp"/>